|
|
|
|
|
|
|
A subsystem-based application model, whether based on Microsoft's three-tiered Service model or a more specialized type of model, should reflect the concept that each subsystem must |
|
|
|
|
|
|
|
|
Have well-defined interface classes acting as ambassadors, facades, or mediators |
|
|
|
|
|
|
|
|
Encapsulate any platform-specific or legacy-specific dependencies from its core services |
|
|
|
|
|
|
|
|
Ensure type-safety either in the form of self-testing objects or delegating type-checking to the Visual Basic compiler |
|
|
|
|
|
|
|
|
Permit the easy addition and deletion of classes at design time and objects at run-time without endangering its own object interaction structure |
|
|
|
|
|
|
|
|
Have an interface that is easy to review by developer-users to plan for use |
|
|
|
|
|
|
|
|
Be efficient in terms of memory and other resources |
|
|
|
|
|
|
|
|
All of these factors encourage reuse of subsystems and components. Ideally, you should be able to use and reuse a subsystem as is, without being unreasonably burdened with services not being properly fulfilled by it. |
|
|
|
|
|
|
|
|
Note It's not always easy to create a perfect subsystem during the first Visual Basic project, so there's no need to worry about perfection too early. |
|
|
|
|
|
|
|
|
|
Moreover, you could ideally have a subsystem made up entirely of interface classes so that that subsystem serves as a type template for more concrete subsystems that implement this abstract subsystem. This means that every interface class in the subsystem would need to be public. Exercise 1 in the Workshop at the end of this lesson walks you through the detailed steps for creating and implementing an abstract subsystem in the form of an ActiveX component. |
|
|
|
|
|
|
|
|
To create an abstract component, follow these general steps: |
|
|
|
|
|
|
|
|
1. Open a new Visual Basic ActiveX DLL or EXE project. |
|
|
|
|
|
|
|
|
2. Create one or more classes, each with public methods and/or properties but no code. Typically, these interface classes should meaningfully represent the goal and nature of the component, such as Bank Transaction Policy Enforcement. |
|
|
|
|
|
|
|
|
3. Choose Project Properties from the menu and give the project a name that reflects the component's goal. You might use the term Abstract in both the project name and description. |
|
|
|
|
|
|
|
|
4. Save the project with a filename prefixed with the word Abstract. |
|
|
|
|
|